class Animal:
    def __init__(self, name):
        self.name = name

    def eat(self):
        print(self.name + ' is eating')


class Dog(Animal):
    def __init__(self, name, breed):
        super().__init__(name)
        self.breed = breed

    def bark(self):
        print(self.name + ' is barking.')


dog = Dog('dog', 'wwwww')
dog.bark()


class Animal:
    def __init__(self, name):
        self.name = name

    def eat(self):
        print(self.name + '正在吃东西')

    def sleep(self):
        print(self.name + '正在睡觉')


class Bird(Animal):
    def fly(self):
        print(self.name + '正在飞翔')


class Fish(Animal):
    def swim(self):
        print(self.name + '正在游泳')


class Penguin(Bird, Fish):
    def __init__(self, name):
        super().__init__(name)

    def run(self):
        print(self.name + '正在奔跑')


penguin = Penguin('企鹅')
penguin.eat()
penguin.sleep()
penguin.fly()
penguin.swim()
penguin.run()
print(Penguin.mro())


class Student:
    def __init__(self, num, name, age, sex, height, weight, grade, address, telephone):
        self.num = num
        self.name = name
        self.age = age
        self.sex = sex
        self.height = height
        self.weight = weight
        self.grade = grade
        self.address = address
        self.telephone = telephone

    def study(self, time):
        print(self.name + '学习了{}小时'.format(time))

    def play(self, game):
        print(self.name + '玩{}游戏'.format(game))

    def write(self, row):
        print(self.name + '编写了{}代码'.format(row))

    def total(self, lis):
        sum = 0
        if lis:
            for x in lis:
                sum += x
        print(sum)


student = Student('210704', 'jack', 15, '男', 1.75, 80, 80, '河南', 134565425)
student.study(20)
student.play(input('请输入游戏名称'))
student.write(80)
student.total([1, 2, 3, 4, 5])


class Car:
    def __init__(self, c_num, c_cheer, c_color, c_weight, c_size, ):
        self.c_num = c_num
        self.c_cheer = c_cheer
        self.c_color = c_color
        self.c_weight = c_weight
        self.c_size = c_size

    def type(self, way):
        print('此车的具体功能为{}'.format(way))


car1 = Car('21254', 4, 'red', 800, '50寸')
car1.type('跑车')
car2 = Car('12345', 4, 'blue', 700, '60寸')
car2.type('代步')
car3 = Car('56789', 4, 'green', 750, '55寸')
car3.type('拉货')
car4 = Car('12345', 4, 'black', 1000, '80寸')
car4.type('拉货')
car5 = Car('12365', 4, 'white', 5000, '120寸')
car5.type('拉货')


class Computer:
    def __init__(self, num, time, color, weight, cpu, memory, disk):
        self.num = num
        self.time = time
        self.color = color
        self.weight = weight
        self.cpu = cpu
        self.memory = memory
        self.disk = disk

    def play(self, game):
        print('打{}游戏'.format(game))

    def work(self, job):
        print('做{}'.format(job))


computer = Computer(2125, 50, 'red', 4, 'i7', '32GB', '1TB')
computer.play('www')
computer.work('wdwdwdw')


class Monkey:
    def __init__(self, type, sex, b_color, weight):
        self.type = type
        self.sex = sex
        self.b_color = b_color
        self.weight = weight

    def fire(self, tool):
        print('用{}造火'.format(tool))

    def m_study(self, lis):
        if lis:
            print('学习', end='')
            for x in lis:
                print(x, end=',')


monkey = Monkey('金丝猴', '公', 'yellow', 50, )
monkey.fire('石头')
monkey.m_study(['吃饭', '捕猎'])


# 打电话业务
class Person:
    def __init__(self, name, sex, age, balance, brand, capacity, screen, s_time, points):
        self.name = name
        self.sex = sex
        self.age = age
        self.balance = balance
        self.brand = brand
        self.capacity = capacity
        self.screen = screen
        self.s_time = s_time
        self.points = points

    def edit(self, content):
        print('短信内容为{}'.format(content))

    def play(self, num, time):
        if num:
            if self.balance >= 1:
                if time < 0:
                    print('请输入大于等于零的数字')
                elif 0 <= time < 10:
                    self.balance -= time
                    self.points += time * 15
                elif 10 <= time < 20:
                    self.balance -= time * 0.8
                    self.points += time * 39
                else:
                    self.balance -= time * 0.65
                    self.points += time * 48
            else:
                print('话费小于1元')
        else:
            print('电话号码为空')


person1 = Person('jack', '男', 18, 50, 'vivo', '5000mh', '16:8', 5, 0)
person2 = Person('mike', '男', 19, 40, 'oppo', '6000mh', '16:16', 4, 0)
person1.play(input('请输入电话号码'), float(input('请输入要打的时间长度:')))
print(person1.balance, person1.points)
